package com.campus.common.enums;

public enum OrderStatusEnum {

    PENDING_PAYMENT(1, "待付款"),
    PENDING_ACCEPTANCE(2, "待接单"),
    PROCESSING(3, "进行中"),
    COMPLETED(4, "已完成"),
    CANCELLED(5, "已取消");

    private final int value;
    private final String text;

    OrderStatusEnum(int value, String text) {
        this.value = value;
        this.text = text;
    }

    /**
     * Gets value.
     *
     * @return the value
     */
    public int getValue() {
        return value;
    }

    /**
     * Gets text.
     *
     * @return the text
     */
    public String getText() {
        return text;
    }

    /**
     * Gets by value.
     *
     * @param value the value
     * @return the by value
     */
    public static OrderStatusEnum getByValue(int value) {
        for (OrderStatusEnum temp : OrderStatusEnum.values()) {
            if (temp.getValue() == value) {
                return temp;
            }
        }
        return null;
    }
}